package top.wjgyy.tools.ddns.view;

import com.aliyuncs.alidns.model.v20150109.DescribeDomainRecordsResponse;
import com.aliyuncs.domain.model.v20180129.QueryDomainListResponse;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import top.wjgyy.tools.ddns.enums.AliConstants;



public abstract class IndexView implements Initializable {

    @FXML
    protected StackPane stack;

    @FXML
    protected ComboBox<QueryDomainListResponse.Domain> domainCombo;

    @FXML
    protected ComboBox<DescribeDomainRecordsResponse.Record> domainRecordsCombo;

    @FXML
    protected ComboBox<AliConstants> domainTypeCombo;

    @FXML
    protected ComboBox<String> cycleCombo;

    @FXML
    protected TextField ipv4Field, ipv6Field, recordsAdrressField;

    @FXML
    protected Spinner<Integer> timeSpinner;

    @FXML
    protected Button runButton, cancelButton;

    @FXML
    protected ListView historyArea;

    private double x,y;

    public void a(MouseEvent event){
        Stage stage = (Stage) stack.getScene().getWindow();
        stage.setX(event.getScreenX() + x);
        stage.setY(event.getScreenY() + y);
        // System.out.println("stageX:" + stage.getX() + "  stageY:" + stage.getY());
    }

    public void b(MouseEvent event){
        Stage stage = (Stage) stack.getScene().getWindow();
        x = stage.getX() - event.getScreenX();
        y = stage.getY() - event.getScreenY();
    }

}
